import React, { Component } from "react";
import { Card, Tabs } from "antd";
import Hh from "../../assets/hh.jpg"
import styled from "styled-components";
import Passwdlogin from "./PasswdLogin";
import Mobilelogin from "./MobileLogin";
class Index extends Component {
    constructor(props) {
        super(props)
        let jwt = sessionStorage.getItem("jwt")
        if(jwt) this.props.history.push("/dashboard")
    }
    render() {
        const { TabPane } = Tabs;
        return (
            <Container>
                <LoginForm>
                    <Card style={{ borderRadius:"19px" }}>
                        <Tabs defaultActiveKey="1" centered>
                            <TabPane tab="密码登录" key="1">
                                <Passwdlogin/>
                            </TabPane>
                            <TabPane tab="短信登录" key="2">
                                <Mobilelogin/>
                            </TabPane>
                        </Tabs>
                    </Card>,
                </LoginForm>
            </Container>
        );
    }
}

const Container = styled.div`
    width: 100%;
    height: 100%;
    background: url(${Hh}) no-repeat;
    padding-top: 18%;
    background-size: cover;
    overflow: hidden;
`
const LoginForm = styled.div`
    width: 400px;
    margin: 0 auto;
`
export default Index;
